<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--1、引入axios库-->
    <script src="../js/axios-0.18.0.js"></script>
</head>
<body>


<script>
//2、获取来自Servlet的响应数据
/* 方式一：
    axios({
        method:"get",
        url:"http://localhost:8080/day11_filter/AxiosServlet?username=张三"
        /!*这里的参数也可以使用data进行传递
        data:"username=张三"
        *!/
    }).then(function (response) {
        alert(response.data);
    })
    */
/*方式二：对上面的代码再进行简化*/
    /*axios.get("http://localhost:8080/day11_filter/AxiosServlet").then(function (response) {
        alert(response.data);
    })*/
    axios.post("http://localhost:8080/day11_filter/AxiosServlet","username=张三").then((function (response) {
        alert(response.data);
    }))
</script>
</body>
</html>